package com.car.sale.vo;

public class Result<T> {
    private int code;//返回状态码
    private String msg;//返回msg
    private T date;//返回的数据

    public Result(int code, String msg, T date) {
        this.code = code;
        this.msg = msg;
        this.date = date;
    }

    //    以下是静态类
    public static Result<Object> success(Object date)
    {
        return new Result<>(1,"成功",date);
    }

    public static Result<Object> success(int code,String msg,Object date)
    {
        return new Result<>(code,msg,date);
    }

    public static Result<Object> fail()
    {
        return new Result<>(-1,"失败",null);
    }

    public static Result<Object> fail(int code,String msg)
    {
        return new Result<>(code,msg,null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getDate() {
        return date;
    }

    public void setDate(T date) {
        this.date = date;
    }
}
